<%@ page import="com.ama.dao.ContractDao" %>
<%@ page import="com.ama.utils.SpringUtils" %>
<%@ page import="org.w3c.dom.CDATASection" %>
<%@ page import="com.ama.pojo.Contract" %>
<%@ page import="com.ama.service.StaffService" %>
<%@ page import="com.ama.service.impl.StaffServiceImpl" %>
<%@ page import="com.ama.service.PropertyService" %>
<%@ page import="com.ama.service.impl.PropertyServiceImpl" %>
<%@ page import="com.ama.dao.CostDao" %>
<%@ page import="com.ama.pojo.Cost" %>
<%@ page import="com.ama.pojo.Staff" %>
<%@ page import="com.ama.pojo.Property" %><%--<%@ page import="com.ama.utils.SpringUtils" %>--%>

<%--
  Created by IntelliJ IDEA.
  User: AMAZZED
  Date: 2020/12/19
  Time: 14:47
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html lang="zh">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"/>
    <title>合同单</title>
    <link rel="icon" href="favicon.ico" type="image/ico">
    <meta name="keywords" content="LightYear,光年,后台模板,后台管理系统,光年HTML模板">
    <meta name="description" content="LightYear是一个基于Bootstrap v3.3.7的后台管理系统的HTML模板。">
    <meta name="author" content="yinqi">
    <link href="../css/bootstrap.min.css" rel="stylesheet">
    <link href="../css/materialdesignicons.min.css" rel="stylesheet">
    <link href="../css/style.min.css" rel="stylesheet">
    <style type="text/css">
        input[readonly],
        .form-control[readonly]{
            background-color: #FFFFFF;
        }
    </style>
</head>
<%
    Long contractId = Long.valueOf(request.getParameter("contractId"));
    ContractDao contractDao = SpringUtils.getBean(ContractDao.class);
    Contract contract = contractDao.selectByPrimaryKey(contractId);

    CostDao costDao  = SpringUtils.getBean(CostDao.class);
    StaffService staffService = SpringUtils.getBean(StaffServiceImpl.class);
    PropertyService propertyService = SpringUtils.getBean(PropertyServiceImpl.class);
    Long staffId = contract.getStaffId();
    Long propertyId = contract.getPropertyId();

//    Cost cost = costDao.selectByPrimaryKey(staffService.selectById(staffId).getCostId());
    Staff staff = staffService.selectById(staffId);
    Property property = propertyService.selectById(propertyId);


%>

<body>
<div class="container-fluid p-t-15">


        <div class="row">
            <div class="col-lg-12">
                <div class="card">
                    <div class="card-header"><h4>表单向导</h4></div>
                    <div class="card-body">

                        <form action="#" method="post" class="guide-box" data-navigateable="true">




                            <div class=" text-center m-b-10"><h4>合同单</h4></div>
                            <hr>
                        <div class="row m-b-10">
                            <div class="col-lg-12">
                                <div class="input-group">
                                    <span class="input-group-btn">
                                      <button class="btn btn-default" type="button">合同号</button>
                                    </span>
                                    <input name="applyNum" type="text" class="form-control"  readonly value="<%=contract.getContractNum()%>">
                                </div>
                            </div>
                        </div>

                        <div class="row m-b-10">
                            <div class="col-lg-6 m-b-10">
                                <div class="input-group">
                                    <span class="input-group-btn">
                                      <button class="btn btn-default" type="button">乙方名称</button>
                                    </span>
                                    <input type="text" class="form-control" readonly value="<%=propertyService.selectById(contract.getPropertyId()).getPropertyName()%>">
                                </div>
                            </div>

                            <div class="col-lg-6">
                                <div class="input-group">
                                    <span class="input-group-btn">
                                      <button class="btn btn-default" type="button">甲方名称</button>
                                    </span>
                                    <input type="text" class="form-control" readonly value="<%=staffService.selectById(contract.getStaffId()).getStaffName()%>">
                                </div>
                            </div>
                        </div>

                        <div class="row m-b-10">
                            <div class="col-lg-6">
                                <div class="input-group">
                                    <span class="input-group-btn">
                                      <button class="btn btn-default" type="button">合同面积</button>
                                    </span>
                                    <input type="text" class="form-control" readonly value="<%=contract.getContractArea()%>">
                                </div>
                            </div>

                        </div>
<%--                        <div class="row m-b-10">--%>
<%--                            <div class="col-lg-6">--%>
<%--                                <div class="input-group">--%>
<%--                                    <span class="input-group-btn">--%>
<%--                                      <button class="btn btn-default" type="button">合同类型</button>--%>
<%--                                    </span>--%>
<%--                                    <input type="text" class="form-control" readonly value="">--%>
<%--                                </div>--%>
<%--                            </div>--%>
<%--                        </div>--%>



<%--                        <div class="row m-b-10">--%>
<%--                            <div class="col-lg-6">--%>
<%--                                <div class="input-group">--%>
<%--                                    <span class="input-group-btn">--%>
<%--                                      <button class="btn btn-default" type="button">合同总金额</button>--%>
<%--                                    </span>--%>
<%--                                    <input type="text" class="form-control" readonly value="<%=cost.getCostAmount()*3%>">--%>
<%--                                </div>--%>
<%--                            </div>--%>
<%--                        </div>--%>

                        <div class="row m-b-10">
<%--                            <div class="col-lg-6">--%>
<%--                                <div class="input-group">--%>
<%--                                <span class="input-group-btn">--%>
<%--                                  <button class="btn btn-default" type="button">合同应收税</button>--%>
<%--                                </span>--%>
<%--                                    <input type="text" class="form-control" readonly value="<%=cost.getCostTaxamount()%>">--%>
<%--                                </div>--%>
<%--                            </div>--%>
                        </div>

                        <div class="row m-b-10">
                            <div class="col-lg-4 m-b-10">
                                <div class="input-group ">
                                    <span class="input-group-btn">
                                      <button class="btn btn-default" type="button">合同开始日期</button>
                                    </span>
                                    <input type="text" class="form-control" readonly value="<%=contract.getBigindate()%>">
                                </div>
                            </div>
                            <div class="col-lg-4 m-b-10">
                                <div class="input-group">
                                    <span class="input-group-btn">
                                      <button class="btn btn-default" type="button">合同结束日期</button>
                                    </span>
                                    <input type="text" class="form-control" readonly value="<%=contract.getEnddate()%>">
                                </div>
                            </div>
                            <div class="col-lg-4">
                                <div class="input-group">
                                    <span class="input-group-btn">
                                      <button class="btn btn-default" type="button">合同签订日期</button>
                                    </span>
                                    <input type="text" class="form-control" readonly value="<%=contract.getSigndate()%>">
                                </div>
                            </div>
                        </div>
                            <%--<div class="row m-b-10">
                                <div class="col-lg-1">
                                    <div class="form-group">
                                    <span class="input-group-btn">
                                          <button class="btn btn-default" type="button">申请状态</button>
                                    </span>
                                    </div>
                                </div>
                                <div class="col-lg-1">
                                    <%
                                        if(contract.getContractState()==0){
                                    %>
                                    <button class="btn btn-warning btn-w-md" >等待签订</button>
                                    <%
                                    }else if(contract.getContractState()==1){
                                    %>
                                    <button class="btn btn-success btn-w-md" >已签订</button>
                                    <%
                                    }else if(contract.getContractState()==-1) {
                                    %>
                                    <button class="btn btn-danger btn-w-md" >已撤销</button>
                                    <%
                                        }
                                    %>

                                </div>--%>


                                <div class="row m-b-10">

                            <div class="col-lg-6">
                                <div class="input-group">
                                    <span class="input-group-btn">
                                      <button class="btn btn-default" type="button">合同终止日期</button>
                                    </span>
                                    <input type="text" class="form-control" readonly  value="<%=contract.getTerminalDate()%>">
                                </div>
                            </div>
                        </div>


                        <div class="row m-b-10">
                            <div class="col-lg-12">
                                <div class="input-group">
                                    <span class="input-group-btn">
                                      <button class="btn btn-default" type="button">终止原因</button>
                                    </span>
                                    <input type="text" class="form-control" readonly value="<%=contract.getTerminalReason()%>">
                                </div>
                            </div>
                        </div>

                        <div class="row m-b-10">
                            <div class="col-lg-4 m-b-10">
                                <div class="input-group">
                                    <span class="input-group-btn">
                                      <button class="btn btn-default" type="button">终止人</button>
                                    </span>
                                    <input type="text" class="form-control" readonly value="<%=contract.getTerminalPerson()%>">
                                </div>
                            </div>
                        </div>
                            <div class="row m-b-10">
                            <div class="col-lg-4 m-b-10">
                                <div class="input-group">
                                    <span class="input-group-btn">
                                      <button class="btn btn-default" type="button">物业电话</button>
                                    </span>
                                    <input type="text" class="form-control" readonly value="<%=property.getPropertyPhone()%>">
                                </div>
                            </div>
                            </div>
                            <div class="row m-b-10">
                            <div class="col-lg-4">
                                <div class="input-group">
                                    <span class="input-group-btn">
                                      <button class="btn btn-default" type="button">员工电话</button>
                                    </span>
                                    <input type="text" class="form-control" readonly value="<%=staff.getStaffPhone()%>">
                                </div>
                            </div>
                            </div>

                            <div class="row m-b-10">
                                <div class="col-lg-1">
                                    <div class="form-group">
                                    <span class="input-group-btn">
                                          <button class="btn btn-default" type="button">申请状态</button>
                                    </span>
                                    </div>
                                </div>
                                <div class="col-lg-1">
                                    <%
                                        if(contract.getContractState()==0){
                                    %>
                                    <a class="btn btn-warning btn-w-md"  >等待签订</a>
                                    <%
                                    }else if(contract.getContractState()==1){
                                    %>
                                    <a class="btn btn-success btn-w-md"  >已签订</a>
                                    <%
                                    }else if(contract.getContractState()==-1) {
                                    %>
                                    <a class="btn btn-danger btn-w-md"  >已撤销</a>
                                    <%
                                        }
                                    %>

                                </div>


                            </div>



                            <div class="nav-step-button">
                                <%--                            <a class="btn btn-secondary" hidden="hidden" disabled="" data-wizard="prev" type="button" href="s_bed.jsp?room=<%=bed.getRoomId()%>">上一步</a>--%>
                                <%--<a class="btn btn-secondary"
                                        <%
                                            if(apply.getApplyState()==-1){
                                        %>
                                   disabled
                                        <%}%>
                                   href="/cancelApply" >撤销申请</a>--%>

                                <button class="btn btn-secondary" data-wizard="next" >打印合同单</button>
                            </div>

                        </form>
                    </div>
                </div>
            </div>

        </div>

    </div>

<script type="text/javascript" src="../js/jquery.min.js"></script>
<script type="text/javascript" src="../js/bootstrap.min.js"></script>
<script type="text/javascript" src="../js/main.min.js"></script>
<!--向导插件-->
<script type="text/javascript" src="../js/jquery.bootstrap.wizard.min.js"></script>

</body>
</html>
